# 导包
import requests


# 定义一个类
class ConfigHttp():
    # 定义初始化属性
    def __init__(self, method, interfaceUrl, value):
        self.method = method
        self.interfaceUrl = interfaceUrl
        self.value = eval(value)

    # 定义方法，请求数据以及获取结果
    def run(self):
        if self.method.lower() == "get":
            return self.__get()
        elif self.method.lower() == "post":
            return self.__post()
        else:
            print("请求方式写错了！")

    def __get(self):
        re = requests.get(url=self.interfaceUrl, params=self.value)
        return re

    def __post(self):
        re = requests.post(url=self.interfaceUrl, data=self.value)
        return re


if __name__ == '__main__':
    pass